<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/modules/cms/front/include/taglib.jsp"%>
<!DOCTYPE html>
<html>
<head>
	<title>公共留言</title>
	<meta name="decorator" content="cms_default_${site.theme}"/>
	<meta name="description" content="Zcm ${site.description}" />
	<meta name="keywords" content="Zcm ${site.keywords}" />
	<link href="${ctxStatic}/jquery-validation/1.11.1/jquery.validate.min.css" type="text/css" rel="stylesheet" />
	<script src="${ctxStatic}/jquery-validation/1.11.1/jquery.validate.min.js" type="text/javascript"></script>
	<script src="${ctxStatic}/jquery-validation/1.11.1/jquery.validate.method.min.js" type="text/javascript"></script>
	<script type="text/javascript">
		$(document).ready(function() {
			<c:if test="${not empty message}">alert("${message}");</c:if>
			$("#inputForm").validate({
				rules: {
					validateCode: {remote: "${pageContext.request.contextPath}/servlet/validateCodeServlet"}
				},
				messages: {
					content: {required: "请填写留言内容"},
					validateCode: {remote: "验证码不正确"}
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
		});
		function page(n,s){
			location="${ctx}/guestbook?pageNo="+n+"&pageSize="+s;;
		}
	</script>
</head>
<body>
<section class="g-bannerTop" style="background-image: url(${ctxStatic}/zcm/images/banner11.png);"></section>
<section class="content section11">
	<div class="section11-left">
		<div class="title">公共留言</div>
		<div class="list">
			<c:forEach items="${page.list}" var="guestbook">
				<div class="item">
					<div class="con1"><b>${guestbook.name}：</b>${guestbook.content} <time><fmt:formatDate value="${guestbook.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/></time></div>
					<c:if test="${not empty guestbook.reUser}">
						<div class="con2">${guestbook.reUser.name}：${guestbook.reContent}<time><fmt:formatDate value="${guestbook.reDate}" pattern="yyyy-MM-dd HH:mm:ss"/></time></div>
					</c:if>
				</div>
			</c:forEach>
			<c:if test="${fn:length(page.list) eq 0}">
				<div class="item">
					<div class="con1">暂时还没有人留言！</div>
				</div>
			</c:if>
		</div>
		${page.frontHtml}
	</div>
	<div class="section11-right">
		<div class="title">我要留言</div>
		<form:form id="inputForm" action="${ctx}/guestbook" method="post" class="form-horizontal">
		<ul class="form">
			<li><span class="tt">名称：</span><input maxlength="11" class="required"  name="name" type="text"></li>
			<li><span class="tt">邮箱：</span><input maxlength="50" class="required email"  name="email" type="text"></li>
			<li><span class="tt">电话：</span><input maxlength="50" class="required phone"  name="phone" type="text"></li>
			<li><span class="tt">单位：</span><input maxlength="50" class="required"  name="workunit" type="text"></li>
			<li><span class="tt">留言分类：</span>
			<select name="type" class="txt required" >
				<c:forEach items="${fns:getDictList('cms_guestbook')}" var="type">
					<option value="${type.value}">${type.label}</option>
				</c:forEach>
			</select>
			</li>
			<li><span class="tt">留言内容：</span><textarea  name="content" cols="30" rows="10"></textarea></li>
			<li class="yzm"><span class="tt">验证码：</span><sys:validateCode name="validateCode" /></li>
			<script>
                $(function () {
                    $("#validateCode").removeAttr("style");
                    $("#validateCode").siblings("img").addClass("code");
                });
			</script>
			<li class="operate">
				<input type="submit" value="提交" class="btn">
			</li>
		</ul>
		</form:form>
	</div>
</section>
</body>
</html>